From 21ac424e41c06b76fd52cef3d26c279d29e6b9fe Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 16 Feb 2002 18:31:14 +0000 Subject: [PATCH] rearrange rules to not emit the example start and end markers. * examples/extract.awk: rearrange rules to not emit the example start and end markers. * docs/tutorial/gtk-tut.sgml: turn the start and end markers into SGML comments, so they don't clutter the formatted tutorial. --- ChangeLog | 8 ++ ChangeLog.pre-2-0 | 8 ++ ChangeLog.pre-2-10 | 8 ++ ChangeLog.pre-2-2 | 8 ++ ChangeLog.pre-2-4 | 8 ++ ChangeLog.pre-2-6 | 8 ++ ChangeLog.pre-2-8 | 8 ++ docs/tutorial/gtk-tut.sgml | 174 ++++++++++++++++++------------------- examples/extract.awk | 18 ++-- 9 files changed, 152 insertions(+), 96 deletions(-) diff --git a/ChangeLog b/ChangeLog index bec71e1825..18a56bd53c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2002-02-16 Matthias Clasen + + * examples/extract.awk: rearrange rules to not emit the example + start and end markers. + + * docs/tutorial/gtk-tut.sgml: turn the start and end markers into + SGML comments, so they don't clutter the formatted tutorial. + 2002-02-16 Havoc Pennington * gtk/gtkwindow.c (gtk_window_parse_geometry): take diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index bec71e1825..18a56bd53c 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,11 @@ +2002-02-16 Matthias Clasen + + * examples/extract.awk: rearrange rules to not emit the example + start and end markers. + + * docs/tutorial/gtk-tut.sgml: turn the start and end markers into + SGML comments, so they don't clutter the formatted tutorial. + 2002-02-16 Havoc Pennington * gtk/gtkwindow.c (gtk_window_parse_geometry): take diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index bec71e1825..18a56bd53c 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +2002-02-16 Matthias Clasen + + * examples/extract.awk: rearrange rules to not emit the example + start and end markers. + + * docs/tutorial/gtk-tut.sgml: turn the start and end markers into + SGML comments, so they don't clutter the formatted tutorial. + 2002-02-16 Havoc Pennington * gtk/gtkwindow.c (gtk_window_parse_geometry): take diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index bec71e1825..18a56bd53c 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,11 @@ +2002-02-16 Matthias Clasen + + * examples/extract.awk: rearrange rules to not emit the example + start and end markers. + + * docs/tutorial/gtk-tut.sgml: turn the start and end markers into + SGML comments, so they don't clutter the formatted tutorial. + 2002-02-16 Havoc Pennington * gtk/gtkwindow.c (gtk_window_parse_geometry): take diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index bec71e1825..18a56bd53c 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +2002-02-16 Matthias Clasen + + * examples/extract.awk: rearrange rules to not emit the example + start and end markers. + + * docs/tutorial/gtk-tut.sgml: turn the start and end markers into + SGML comments, so they don't clutter the formatted tutorial. + 2002-02-16 Havoc Pennington * gtk/gtkwindow.c (gtk_window_parse_geometry): take diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index bec71e1825..18a56bd53c 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +2002-02-16 Matthias Clasen + + * examples/extract.awk: rearrange rules to not emit the example + start and end markers. + + * docs/tutorial/gtk-tut.sgml: turn the start and end markers into + SGML comments, so they don't clutter the formatted tutorial. + 2002-02-16 Havoc Pennington * gtk/gtkwindow.c (gtk_window_parse_geometry): take diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index bec71e1825..18a56bd53c 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +2002-02-16 Matthias Clasen + + * examples/extract.awk: rearrange rules to not emit the example + start and end markers. + + * docs/tutorial/gtk-tut.sgml: turn the start and end markers into + SGML comments, so they don't clutter the formatted tutorial. + 2002-02-16 Havoc Pennington * gtk/gtkwindow.c (gtk_window_parse_geometry): take diff --git a/docs/tutorial/gtk-tut.sgml b/docs/tutorial/gtk-tut.sgml index 9666eee08b..264f291f72 100755 --- a/docs/tutorial/gtk-tut.sgml +++ b/docs/tutorial/gtk-tut.sgml @@ -130,7 +130,7 @@ program possible. This program will create a 200x200 pixel window and has no way of exiting except to be killed by using the shell. -/* example-start base base.c */ + #include <gtk/gtk.h> @@ -148,7 +148,7 @@ int main( int argc, return(0); } -/* example-end */ + You can compile the above program with gcc using: @@ -240,7 +240,7 @@ occur. In our simple example, however, events are ignored. hello world a la GTK. -/* example-start helloworld helloworld.c */ + #include <gtk/gtk.h> @@ -340,7 +340,7 @@ int main( int argc, return(0); } -/* example-end */ + @@ -955,7 +955,7 @@ better examples of callbacks. This will also introduce us to our next topic, packing widgets. -/* example-start helloworld2 helloworld2.c */ + #include <gtk/gtk.h> @@ -1050,7 +1050,7 @@ int main( int argc, return(0); } -/* example-end */ + Compile this program using the same linking arguments as our first @@ -1201,7 +1201,7 @@ it. Compile it yourself and play with it. Packing Demonstration Program -/* example-start packbox packbox.c */ + #include <stdio.h> #include <stdlib.h> @@ -1493,7 +1493,7 @@ int main( int argc, return(0); } -/* example-end */ + @@ -1668,7 +1668,7 @@ Which means it should look something like this: Here's the source code: -/* example-start table table.c */ + #include <gtk/gtk.h> @@ -1766,7 +1766,7 @@ int main( int argc, return 0; } -/* example-end */ + @@ -2017,7 +2017,7 @@ from the rest so you can use it in your programs. There are further examples of using pixmaps later in the tutorial. -/* example-start buttons buttons.c */ + #include <gtk/gtk.h> @@ -2123,7 +2123,7 @@ int main( int argc, return(0); } -/* example-end */ + The xpm_label_box function could be used to pack xpm's and labels into @@ -2332,7 +2332,7 @@ the second will emit its "toggled" signal (to report becoming active). The following example creates a radio button group with three buttons. -/* example-start radiobuttons radiobuttons.c */ + #include <gtk/gtk.h> #include <glib.h> @@ -2414,7 +2414,7 @@ int main( int argc, return(0); } -/* example-end */ + @@ -2959,7 +2959,7 @@ the section on adjustments, so you can see how they affect the way these widgets work for the user. -/* example-start rangewidgets rangewidgets.c */ + #include <gtk/gtk.h> @@ -3249,7 +3249,7 @@ int main( int argc, return(0); } -/* example-end */ + You will notice that the program does not call gtk_signal_connect @@ -3351,7 +3351,7 @@ makes use of the Frame widget to better demonstrate the label styles. You can ignore this for now as the Frame widget is explained later on. -/* example-start label label.c */ + #include <gtk/gtk.h> @@ -3452,7 +3452,7 @@ int main( int argc, return(0); } -/* example-end */ + @@ -3502,7 +3502,7 @@ point. The shadow_type argument may take one of these values: Here's a brief example to illustrate their use. -/* example-start arrow arrow.c */ + #include <gtk/gtk.h> @@ -3575,7 +3575,7 @@ int main( int argc, return(0); } -/* example-end */ + @@ -3889,7 +3889,7 @@ gtk_progress_bar_update function in the same manner. code also shows you how to reset the Progress Bar. -/* example-start progressbar progressbar.c */ + #include <gtk/gtk.h> @@ -4109,7 +4109,7 @@ int main( int argc, return(0); } -/* example-end */ + @@ -4329,7 +4329,7 @@ managing. Val is the pixmap created using GDK. The following is an example of using a pixmap in a button. -/* example-start pixmap pixmap.c */ + #include <gtk/gtk.h> @@ -4418,7 +4418,7 @@ int main( int argc, return 0; } -/* example-end */ + To load a file from an XPM data file called icon0.xpm in the current @@ -4447,7 +4447,7 @@ icon. The following example displays a full wheelbarrow image on the desktop. -/* example-start wheelbarrow wheelbarrow.c */ + #include <gtk/gtk.h> @@ -4622,7 +4622,7 @@ int main (int argc, return(0); } -/* example-end */ + To make the wheelbarrow image sensitive, we could attach the button @@ -4728,7 +4728,7 @@ vertical ruler spans from 0 to 400 with a mark every 100 pixels. Placement of the drawing area and the rulers is done using a table. -/* example-start rulers rulers.c */ + #include <gtk/gtk.h> @@ -4806,7 +4806,7 @@ int main( int argc, return(0); } -/* example-end */ + @@ -4868,7 +4868,7 @@ pushing items onto the statusbar, and one for popping the last item back off. -/* example-start statusbar statusbar.c */ + #include <gtk/gtk.h> #include <glib.h> @@ -4944,7 +4944,7 @@ int main( int argc, return 0; } -/* example-end */ + @@ -5044,7 +5044,7 @@ removed. The following code is an example of using an Entry widget. -/* example-start entry entry.c */ + #include <stdio.h> #include <gtk/gtk.h> @@ -5137,7 +5137,7 @@ int main( int argc, gtk_main(); return(0); } -/* example-end */ + @@ -5382,7 +5382,7 @@ void gtk_spin_button_update( GtkSpinButton *spin_button ); It's example time again. -/* example-start spinbutton spinbutton.c */ + #include <stdio.h> #include <gtk/gtk.h> @@ -5602,7 +5602,7 @@ int main( int argc, return(0); } -/* example-end */ + @@ -5941,7 +5941,7 @@ and are: example code. -/* example-start calendar calendar.c */ + /* * Copyright (C) 1998 Cesar Miquel, Shawn T. Amundson, Mattias Grönlund * Copyright (C) 2000 Tony Gale @@ -6362,7 +6362,7 @@ int main(int argc, return(0); } -/* example-end */ + @@ -6475,7 +6475,7 @@ changing the color in the color selection dialog changes the background color. -/* example-start colorsel colorsel.c */ + #include <glib.h> #include <gdk/gdk.h> @@ -6618,7 +6618,7 @@ gint main( gint argc, return(0); } -/* example-end */ + @@ -6675,7 +6675,7 @@ selection widget. While in this example the Help button appears on the screen, it does nothing as there is not a signal attached to it. -/* example-start filesel filesel.c */ + #include <gtk/gtk.h> @@ -6723,7 +6723,7 @@ int main( int argc, gtk_main (); return 0; } -/* example-end */ + @@ -6772,7 +6772,7 @@ mouse-click on the label causes the program to exit. Resizing the window reveals varying amounts of the label. -/* example-start eventbox eventbox.c */ + #include <gtk/gtk.h> @@ -6825,7 +6825,7 @@ int main( int argc, return(0); } -/* example-end */ + @@ -6911,7 +6911,7 @@ position. The following example illustrates how to use the Fixed Container. -/* example-start fixed fixed.c */ + #include <gtk/gtk.h> @@ -6984,7 +6984,7 @@ int main( int argc, return(0); } -/* example-end */ + @@ -7124,7 +7124,7 @@ void gtk_frame_set_shadow_type( GtkFrame *frame, The following code example illustrates the use of the Frame widget. -/* example-start frame frame.c */ + #include <gtk/gtk.h> @@ -7175,7 +7175,7 @@ int main( int argc, return(0); } -/* example-end */ + @@ -7222,7 +7222,7 @@ drawing area whose aspect ratio will always be 2:1, no matter how the user resizes the top-level window. -/* example-start aspectframe aspectframe.c */ + #include <gtk/gtk.h> @@ -7265,7 +7265,7 @@ int main( int argc, gtk_main (); return 0; } -/* example-end */ + @@ -7316,7 +7316,7 @@ correct portions shrink instead of being pushed off the bottom of the window. -/* example-start paned paned.c */ + #define GTK_ENABLE_BROKEN #include <stdio.h> @@ -7454,7 +7454,7 @@ int main( int argc, gtk_main (); return 0; } -/* example-end */ + @@ -7566,7 +7566,7 @@ into a scrolled window. I've only commented on the parts that may be new to you. -/* example-start scrolledwin scrolledwin.c */ + #include <stdio.h> #include <gtk/gtk.h> @@ -7660,7 +7660,7 @@ int main( int argc, return(0); } -/* example-end */ + Try playing with resizing the window. You'll notice how the scrollbars @@ -7738,7 +7738,7 @@ GtkButtonBoxStyle gtk_vbutton_box_get_layout_default( void ); for Button Boxes. -/* example-start buttonbox buttonbox.c */ + #include <gtk/gtk.h> @@ -7859,7 +7859,7 @@ int main( int argc, return(0); } -/* example-end */ + @@ -8454,7 +8454,7 @@ the tabs and border, remove a page, change pages in both a forward and backward manner, and exit the program. -/* example-start notebook notebook.c */ + #include <stdio.h> #include <gtk/gtk.h> @@ -8630,7 +8630,7 @@ int main( int argc, return(0); } -/* example-end */ + I hope this helps you on your way with creating notebooks for your @@ -9214,7 +9214,7 @@ gtk_signal_connect(GTK_OBJECT( clist), A CList example -/* example-start clist clist.c */ + #include <gtk/gtk.h> @@ -9387,7 +9387,7 @@ int main( int argc, return(0); } -/* example-end */ + @@ -10298,7 +10298,7 @@ tree, and connects all the signals for the relevant objects, so you can see when they are emitted. -/* example-start tree tree.c */ + #define GTK_ENABLE_BROKEN #include <gtk/gtk.h> @@ -10480,7 +10480,7 @@ int main( int argc, gtk_main(); return 0; } -/* example-end */ + @@ -10732,7 +10732,7 @@ by a menu bar, as shown in the sample code. That should about do it. Let's take a look at an example to help clarify. -/* example-start menu menu.c */ + #include <stdio.h> #include <gtk/gtk.h> @@ -10865,7 +10865,7 @@ static void menuitem_response( gchar *string ) { printf ("%s\n", string); } -/* example-end */ + You may also set a menu item to be insensitive and, using an accelerator @@ -10889,7 +10889,7 @@ gtk_item_factory calls. Here is an example using the GTK item factory. -/* example-start menu itemfactory.c */ + #include <gtk/gtk.h> #include <strings.h> @@ -11002,7 +11002,7 @@ int main( int argc, return(0); } -/* example-end */ + For now, there's only this example. An explanation and lots 'o' comments @@ -11284,7 +11284,7 @@ extend the selection. A GtkText Example -/* example-start text text.c */ + /* text.c */ @@ -11468,7 +11468,7 @@ int main( int argc, return(0); } -/* example-end */ + @@ -12462,7 +12462,7 @@ which is a list of all targets into which the selection can be converted. -/* example-start selection gettargets.c */ + #include <gtk/gtk.h> @@ -12558,7 +12558,7 @@ int main( int argc, return 0; } -/* example-end */ + @@ -12631,7 +12631,7 @@ itself), is the "STRING" target. When this target is requested, a string representation of the time is returned. -/* example-start selection setselection.c */ + #include <gtk/gtk.h> #include <time.h> @@ -12738,7 +12738,7 @@ int main( int argc, return 0; } -/* example-end */ + @@ -17485,7 +17485,7 @@ which are not included in complete form elsewhere. tictactoe.h -/* example-start tictactoe tictactoe.h */ + /* GTK - The GIMP Toolkit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald @@ -17549,7 +17549,7 @@ void tictactoe_clear (Tictactoe *ttt); #endif /* __TICTACTOE_H__ */ -/* example-end */ + @@ -17559,7 +17559,7 @@ void tictactoe_clear (Tictactoe *ttt); tictactoe.c -/* example-start tictactoe tictactoe.c */ + /* GTK - The GIMP Toolkit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald @@ -17719,7 +17719,7 @@ tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt) } } -/* example-end */ + @@ -17729,7 +17729,7 @@ tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt) ttt_test.c -/* example-start tictactoe ttt_test.c */ + #include <gtk/gtk.h> #include "tictactoe.h" @@ -17773,7 +17773,7 @@ int main( int argc, return 0; } -/* example-end */ + @@ -17788,7 +17788,7 @@ int main( int argc, gtkdial.h -/* example-start gtkdial gtkdial.h */ + /* GTK - The GIMP Toolkit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald @@ -17880,7 +17880,7 @@ void gtk_dial_set_adjustment (GtkDial *dial, #endif /* __GTK_DIAL_H__ */ -/* example-end */ + @@ -17890,7 +17890,7 @@ void gtk_dial_set_adjustment (GtkDial *dial, gtkdial.c -/* example-start gtkdial gtkdial.c */ + /* GTK - The GIMP Toolkit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald @@ -18545,7 +18545,7 @@ gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment, dial->old_value = adjustment->value; } } -/* example-end */ + @@ -18634,7 +18634,7 @@ int main( int argc, scribble-simple.c -/* example-start scribble-simple scribble-simple.c */ + /* GTK - The GIMP Toolkit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald @@ -18813,7 +18813,7 @@ int main( int argc, return 0; } -/* example-end */ + @@ -18823,7 +18823,7 @@ int main( int argc, scribble-xinput.c -/* example-start scribble-xinput scribble-xinput.c */ + /* GTK - The GIMP Toolkit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald @@ -18956,7 +18956,7 @@ motion_notify_event (GtkWidget *widget, GdkEventMotion *event) { x = event->x; y = event->y; - gdk_event_get_axis ((GdkEvent *)event, GDK_AXIS_PRESSURE, &pressure); + gdk_event_get_axis ((GdkEvent *)event, GDK_AXIS_PRESSURE, &pressure); state = event->state; } @@ -19081,7 +19081,7 @@ main (int argc, char *argv[]) return 0; } -/* example-end */ + @@ -19333,7 +19333,7 @@ selection of a List, and lets you "arrest" list items into a prison by selecting them with the rightmost mouse button. -/* example-start list list.c */ + /* Include the GTK header files * Include stdio.h, we need that for the printf() function @@ -19610,7 +19610,7 @@ void sigh_print_selection( GtkWidget *gtklist, } g_print("\n"); } -/* example-end */ + diff --git a/examples/extract.awk b/examples/extract.awk index 25025f8e5b..a1efd673c7 100644 --- a/examples/extract.awk +++ b/examples/extract.awk @@ -31,6 +31,15 @@ BEGIN {in_example=0; check=0; spec_example=""; do_output=0; flatten=0; verbose=0 } } +$2 == "example-end" && in_example == 0 { printf("\nERROR: multiple ends at line %d\n", NR) > "/dev/stderr"; + exit} +$2 == "example-end" { in_example=0; do_output=0 } + +in_example==1 && check==0 && do_output==1 { gsub(/&/, "\\&", $0); + gsub(/</, "<", $0); + gsub(/>/, ">", $0); + print $0 >file_name } + $2 == "example-start" && in_example == 1 { printf("\nERROR: nested example at line %d\n", NR) > "/dev/stderr"; exit} @@ -53,15 +62,6 @@ $2 == "example-start" && check == 0 \ } } -in_example==1 && check==0 && do_output==1 { gsub(/&/, "\\&", $0); - gsub(/</, "<", $0); - gsub(/>/, ">", $0); - print $0 >file_name } - -$2 == "example-end" && in_example == 0 { printf("\nERROR: multiple ends at line %d\n", NR) > "/dev/stderr"; - exit} -$2 == "example-end" { in_example=0; do_output=0 } - END {} -- 2.30.2